package com.vae.learn.feignclient;

;
import com.vae.content.domain.entity.CoursePublish;
import com.vae.learn.feignclient.ContentServiceClient;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.Map;

@Component
public class ContentServiceClientFallbackFactory implements FallbackFactory<ContentServiceClient> {
    @Override
    public ContentServiceClient create(Throwable throwable) {
        return new ContentServiceClient() {
            @Override
            public CoursePublish getCoursepublish(Long courseId) {
                System.out.println("调用内容管理服务发生熔断: "+ throwable.toString());
                return null;
            }

            @Override
            public Map<Integer, String> getTeachplanByCourseId(Long courseId) {
                System.out.println("调用内容管理服务发生熔断: "+ throwable.toString());
                return null;
            }

            @Override
            public Boolean getTeachplanIsPreview(Long teachplanId) {
                System.out.println("调用内容管理服务发生熔断: "+ throwable.toString());
                return null;
            }
        };
    }
}